#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
class Point {
private:
	double x, y;
public:
	Point() {
		x = 0;
		y = 0;
		cout << "Constructor." << endl;
	};
	Point(double x_value, double y_value) {
		x = x_value;
		y = y_value;
	}
	Point(const Point& p) {
		x = p.x;
		y = p.y;
	}
	double getX() {
		return x;
	}
	double getY() {
		return y;
	}
	void setX(double x_value) {
		x = x_value;
	}
	void setY(double y_value) {
		y = y_value;
	}
	void setXY(double x_value, double y_value) {
		x = x_value;
		y = y_value;
	}
	double getDisTo(const Point& p) {
		double s = pow(pow(x - p.x, 2) + pow(y - p.y, 2),0.5);
		return s;
	}
	~Point() {
		x = 0;
		y = 0;
		cout << "Distructor." << endl;
	}
};
int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		int n;
		cin >> n;
		double max = 0;
		int max_x;
		int max_y;
		Point* ptr = new Point[n];
		for (int j = 0; j < n; j++) {
			double x, y;
			cin >> x >> y;
			ptr[j].setXY(x, y);
		}
		for (int j = 0; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (ptr[j].getDisTo(ptr[k]) > max) {
					max = ptr[j].getDisTo(ptr[k]);
					max_x = j;
					max_y = k;
				}
			}
		}
		cout << "The longeset distance is ";
		cout << fixed << setprecision(2) << max;
	    cout << ",between p[" << max_x << "] and p[" << max_y << "]." << endl;
		delete[] ptr;
	}
}